package com.sunda.spmsoversea.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sunda.spmsoversea.entity.OverseaOperateLog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 海外仓操作日志表 Mapper 接口
 * </p>
 *
 * @author Wayne
 * @since 2021-08-26
 */
@Mapper
public interface OverseaOperateLogMapper extends BaseMapper<OverseaOperateLog> {

    @Select("SELECT AUTO_ID_LOG AS \"autoIdLog\",\n" +
            "       DOCUMENT_NUMBER AS \"documentNumber\",\n" +
            "       LOG_CONTENT AS \"logContent\",\n" +
            "       LOG_CONTENT_EN AS \"logContentEn\",\n" +
            "       LOG_TYPE AS \"logType\",\n" +
            "       REMARK AS \"remark\",\n" +
            "       USER_ID AS \"userId\",\n" +
            "       LAST_NAME AS \"username\",\n" +
            "       CREATE_TIME AS \"createTime\"\n" +
            "FROM OVERSEA_OPERATE_LOG OOL\n" +
            "    LEFT JOIN SPMS_USER U ON OOL.USER_ID = U.WORK_CODE WHERE OOL.DOCUMENT_NUMBER = #{documentNumber} \n" +
            "ORDER BY AUTO_ID_LOG ASC ")
    List<Map<String, Object>> getByDocumentNumber(@Param("documentNumber") String documentNumber);

}
